$(function() {
	new Vue({
		el: "#orderListApp",
		data: {
			currentPage: 100,
			formLabelWidth: "120px",
			fullscreenLoading: false,
			dialogFormVisible:false,
			currentPage: 1,
			totalSize:1,
			currentSelectOrder:{},
			totalPrice:0,
			allTableData:[],
		},
		created: function() {
			parent.vueData.$data.hreHtml = "../orderList/index.html";
			parent.vueData.activeIndex = "5";
			parent.vueData.getLeftNav("5")
			parent.vueData.$data.categoryIndex = 0
            this.getOrderList(1);
		},
		methods: {
			handleSelectionChange(val) {
                    
			},
			handleSizeChange(val) {
				this.requestDataWith(val)
			},
			handleCurrentChange(val) {
				this.requestDataWith(val)
			},
			getOrderList(page){
				this.fullscreenLoading = true;
				let param = {
					page: page,
				}
				axios({
					url: POSTURL.refundList,
					method: 'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						console.log(response.data.result);
						 this.allTableData = response.data.result;
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})
			},
			//积分退款
			integrateRefound(orderInfo){
				this.fullscreenLoading = true;
				let param = {
					data: orderInfo.id,
				}
				axios({
					url: POSTURL.auditRefundIntegral,
					method:'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						this.getOrderList(1);
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})
			},
			//其他操作退款
			otherRefound(orderInfo){
			    this.currentSelectOrder = orderInfo
				this.dialogFormVisible = true;
				this.totalPrice = orderInfo.newTotalPrice/100
			},
			//确认退款完成
			configFinishClick(){
				this.fullscreenLoading = true;
				let param = {
					data:this.currentSelectOrder.id
				}
				axios({
					url: POSTURL.auditRefund,
					method:'post',
					data: param
				}).then(response => {
					this.fullscreenLoading = false;
					if (response.data.code === 100) {
						this.dialogFormVisible = false;
						this.totalPrice = 0;
						this.getOrderList(1);
					} else {
						this.$message.error(response.data.message);
					}
				}).catch(error => {
					this.fullscreenLoading = false;
					console.log(error);
					this.$message.error('服务器出错!');
				})
			}
			
		}

	})
})
